package task

import (
	"context"
	"fmt"
	"github.com/reugn/go-quartz/quartz"
)

// CronJob struct implements quartz package's Job interface{}
type CronJob struct {
	Desc       string
	InstanceID string
}

// Execute is called by a Scheduler when the Trigger associated with this job fires.
func (c *CronJob) Execute(ctx context.Context) {
	// Your custom logic
	fmt.Println("Execute----------")
}

// Key returns the unique key for the Job.
func (c *CronJob) Key() int {
	return quartz.HashCode(c.InstanceID)
}

// Description returns the description of the Job.
func (c *CronJob) Description() string {
	return c.Desc
}
